package com.dt.platform.oa.page;

import com.dt.platform.domain.oa.FinCollectTicket;
import com.dt.platform.domain.oa.FinCollectionNoTicket;
import com.dt.platform.domain.oa.FinPaymentNoTicket;
import com.dt.platform.proxy.oa.FinCollectTicketServiceProxy;
import com.dt.platform.proxy.oa.FinCollectionNoTicketServiceProxy;
import com.dt.platform.proxy.oa.FinPaymentNoTicketServiceProxy;
import com.github.foxnic.api.transter.Result;
import org.github.foxnic.web.framework.view.controller.ViewController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import com.dt.platform.proxy.oa.FinCollectionRecordServiceProxy;
import javax.servlet.http.HttpServletRequest;
/**
 * <p>
 * 收款记录模版页面控制器
 * </p>
 * @author 金杰 , maillank@qq.com
 * @since 2025-06-07 13:23:16
*/

@Controller("OaFinCollectionRecordPageController")
@RequestMapping(FinCollectionRecordPageController.prefix)
public class FinCollectionRecordPageController extends ViewController {

	public static final String prefix="business/oa/fin_collection_record";

	private FinCollectionRecordServiceProxy proxy;

	/**
	 * 获得代理对象<br>
	 * 1、单体应用时，在应用内部调用；<br>
	 * 2、前后端分离时，通过配置，以Rest方式调用后端；<br>
	 * 3、微服务时，通过feign调用; <br>
	 * */
	public FinCollectionRecordServiceProxy proxy() {
		if(proxy==null) {
			proxy=FinCollectionRecordServiceProxy.api();
		}
		return proxy;
	}

	/**
	 * 收款记录 功能主页面
	 */
	@RequestMapping("/fin_collection_record_list.html")
	public String list(Model model,HttpServletRequest request) {
		return getTemplatePath(prefix,"fin_collection_record_list");
	}

	@RequestMapping("/ticket_record_list.html")
	public String ticket(Model model,HttpServletRequest request,String ownerId,String pageType) {
		model.addAttribute("ownerId",ownerId);
		model.addAttribute("pageType",pageType);


		Result<FinCollectTicket> billRes= FinCollectTicketServiceProxy.api().getById(ownerId);
		model.addAttribute("billData",billRes.getData());

		return getTemplatePath(prefix,"ticket");
	}

	@RequestMapping("/no_ticket_record_list.html")
	public String noticket(Model model,HttpServletRequest request,String ownerId,String pageType) {
		model.addAttribute("ownerId",ownerId);
		model.addAttribute("pageType",pageType);

		Result<FinCollectionNoTicket> billRes=FinCollectionNoTicketServiceProxy.api().getById(ownerId);
		model.addAttribute("billData",billRes.getData());

		return getTemplatePath(prefix,"no_ticket");
	}


	/**
	 * 收款记录 表单页面
	 */
	@RequestMapping("/fin_collection_record_form.html")
	public String form(Model model,HttpServletRequest request , String id,String ownerId,String ownerType) {
		model.addAttribute("ownerId",ownerId);
		model.addAttribute("ownerType",ownerType);
		return getTemplatePath(prefix,"fin_collection_record_form");
	}
}